﻿<UserControl x:Class="LFSRecord2.View.TimelineLayerKeyView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:lfsv="clr-namespace:LFSRecord2.View"
             xmlns:lfsconv="clr-namespace:LFSRecord2.View.Converters"
             mc:Ignorable="d" 
             d:DesignHeight="200" d:DesignWidth="700"
             Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type StackPanel}}, Path=Width}">
    <UserControl.Resources>
        <lfsconv:IsCollapsedVisibilityConverter x:Key="isCollapsedVisibilityConverter" />
        <lfsconv:LayerTypeColorConverter x:Key="layerTypeColorConverter" />
    </UserControl.Resources>
    <Grid>
        <StackPanel Orientation="Vertical">
            <lfsv:KeylaneSeparatorView DataContext="{Binding}" 
                                       Background="{Binding LayerType, Converter={StaticResource layerTypeColorConverter}}"
                                       MouseLeftButtonDown="KeylaneSeparatorView_MouseDown" />
            <StackPanel Background="#FF8D8D8D">
                <ItemsControl Name="KeyLaneItems" 
                              Visibility="{Binding IsCollapsed, Converter={StaticResource isCollapsedVisibilityConverter}, Mode=TwoWay}" 
                              ItemsSource="{Binding Properties}" 
                              Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=Width}" 
                              Focusable="False">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Vertical">
                                <lfsv:KeylaneView DataContext="{Binding}" />
                            </StackPanel>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </StackPanel>
        </StackPanel>
    </Grid>
</UserControl>
